from fromework.base.basepage import BasePage
from fromework.data.locator_map import BaiduSearchLocator


class BaiduSearchPage(BasePage):
    locators: BaiduSearchLocator = None

    def __init__(self):
        BasePage.__init__(self, url='http://www.baidu.com')
        self.locators = BaiduSearchLocator()

    def is_load_successfully(self) -> bool:
        pass

    def send_search_content(self, content: str):
        self.logger.info(f'send content:{content}')
        self.input_value_with_clean(self.locators.SEARCH_INPUT_BOX, content)
        self.logger.info(f'send content:{content} finish.')

    def search(self):
        self.logger.info('click search button')
        self.click(self.locators.SEARCH_BUTTON)
        self.logger.info('click search button successfully.')
